#include <iostream>
#include <string>
#include <cassert>
class Cut
{
public:
    Cut() = default;
    void cut(std::string &request, std::string &respon)
    {
        while (!request.empty())
        {
            std::string tmp = request;
            int pos = tmp.find("\n");
            assert(pos != std::string::npos);
            tmp = tmp.substr(0, pos);
            request.erase(0, pos + 1);
            pos = tmp.find(" ");
            if (pos == std::string::npos)
                return;
            _x = atoi(tmp.substr(pos - 1, 1).c_str());
            pos += 1;
            _op = *(tmp.substr(pos, 1).c_str());
            pos += 2;
            _y = atoi(tmp.substr(pos, 1).c_str());
            Contrast(_op);
            respon = _respon;
            respon += '\n';
            _respon.clear();
        }
    }
    void Contrast(const char &op)
    {
        switch (op)
        {
        case '+':
            _respon = std::to_string(_x + _y);
            break;
        case '-':
            _respon = std::to_string(_x - _y);
            break;
        case '*':
            _respon = std::to_string(_x * _y);
            break;
        default:
            if (_y == 0)
            {
                std::cout << "出现除0错误,且不做任何操作" << std::endl;
                return;
            }
            _respon = std::to_string(_x / _y);
            break;
        }
    }

private:
    // 左操作数
    int _x;
    // 操作符
    char _op;
    // 右操作数
    int _y;
    std::string _respon;
};